package selectionMethods;

import java.util.ArrayList;

import chromosomes.Chromosome;

public class TournamentSelectorRNA extends TournamentSelector {

	@Override
	protected Chromosome getBestParent(ArrayList<Chromosome> selectedPair) {
		
		double fitnessOne = selectedPair.get(0).getFitnessValue();
		double fitnessTwo = selectedPair.get(1).getFitnessValue();
		if(fitnessOne<=fitnessTwo)
		{
			return selectedPair.get(0);
		}
		return selectedPair.get(1);
	}

	@Override
	protected Chromosome getWorstParent(ArrayList<Chromosome> selectedPair) {
		double fitnessOne = selectedPair.get(0).getFitnessValue();
		double fitnessTwo = selectedPair.get(1).getFitnessValue();
		if(fitnessOne<fitnessTwo)
		{
			return selectedPair.get(0);
		}
		return selectedPair.get(1);
	}

}
